﻿#include <QIcon>
#include <QPixmap>
#include <QDesktopServices>
#include <QUrl>
#include "CTableWidgetB.h"
#include "CHeader.h"


CTableWidgetB::CTableWidgetB(QWidget * parent)
{
	m_nDataType = 0;//默认是任务
	//connect(CImgDownloadTh::instance(), &CImgDownloadTh::imageDownloaded, this, &CTableWidgetB::onImageDownloaded);
}

CTableWidgetB::~CTableWidgetB()
{
	//SAFE_DELETE(m_pRptInterface);
}

void CTableWidgetB::InitUi(int nType)//初始化界面
{
	m_nDataType = nType;
	clear();
	setFocusPolicy(Qt::NoFocus);//不能为焦点
	QStringList headerText;
	setShowGrid(true);
	setStyleSheet("QTableWidget::item{border:1px solid gray ;}");
	if (nType == 0)//任务执行记录
	{
		setColumnCount(12);
		headerText << A2T("序号") << A2T("任务名称") << A2T("执行时间") << A2T("巡检项总数/已执行") << A2T("正常项数") << A2T("异常项数")<<A2T("持续巡检项报警项数") << A2T("任务执行状态") << A2T("操作") << A2T("pdf报表") << A2T("pdf综合报表") << A2T("重新生成机器人报表");
		setColumnWidth(0, 100);
		setColumnWidth(1, 300);
		setColumnWidth(2, 200);
		setColumnWidth(3, 200);
		setColumnWidth(4, 100);
		setColumnWidth(5, 100);
		setColumnWidth(6, 180);
		setColumnWidth(7, 200);
		setColumnWidth(8, 200);
		setColumnWidth(9, 100);
		setColumnWidth(10, 100);
		setColumnWidth(11, 200);
	}
	else if (nType == 1)//持续监测报警明细
	{
		setColumnCount(10);
		headerText << A2T("序号") << A2T("任务名称") << A2T("巡检项类型") << A2T("报警时间") << A2T("报警值") << A2T("报警阈值") << A2T("报警所在位置") << A2T("报警所在托辊号") << A2T("结果图片")<<A2T("操作");
		setColumnWidth(0, 50);
		setColumnWidth(1, 300);
		setColumnWidth(2, 120);
		setColumnWidth(3, 200);
		setColumnWidth(4, 120);
		setColumnWidth(5, 200);
		setColumnWidth(6, 200);
		setColumnWidth(7, 120);
		setColumnWidth(8, 120);
		setColumnWidth(9, 120);
	}
	else if (nType == 2)//巡检项执行记录
	{
		setColumnCount(12);
		headerText << A2T("序号") << A2T("任务名称") << A2T("巡检点名称") << A2T("托辊号")<< A2T("巡检项名称") << A2T("设备类型") << A2T("执行方式") << A2T("执行时间") << A2T("执行结果") << A2T("报警阈值") << A2T("结果图片") << A2T("操作");
		setColumnWidth(0, 50);
		setColumnWidth(1, 300);
		setColumnWidth(2, 120);
		setColumnWidth(3, 120);
		setColumnWidth(4, 200);
		setColumnWidth(5, 120);
		setColumnWidth(6, 200);
		setColumnWidth(7, 200);
		setColumnWidth(8, 120);
		setColumnWidth(9, 120);
		setColumnWidth(10, 120);
		setColumnWidth(11, 120);
	}
	else if (nType == 3)//AI报警记录查询
	{
		setColumnCount(7);
		headerText << A2T("序号") << A2T("算法名称") << A2T("摄像头名称") << A2T("报警时间") << A2T("是否处理") << A2T("报警截图") << A2T("操作");
		setColumnWidth(0, 50);
		setColumnWidth(1, 300);
		setColumnWidth(2, 300);
		setColumnWidth(3, 300);
		setColumnWidth(4, 120);
		setColumnWidth(5, 200);
		setColumnWidth(6, 120);
	}
	else if (nType == 4)//跑偏报警记录查询
	{
		setColumnCount(9);
		headerText << A2T("序号") << A2T("点位名称") << A2T("开始时间") << A2T("结束时间")<<A2T("左侧跑偏值(mm)")<<A2T("右侧跑偏值(mm)")<<A2T("跑偏报警描述") << A2T("报警截图") << A2T("操作");
		setColumnWidth(0, 50);
		setColumnWidth(1, 180);
		setColumnWidth(2, 180);
		setColumnWidth(3, 180);
		setColumnWidth(4, 150);
		setColumnWidth(5, 150);
		setColumnWidth(6, 300);
		setColumnWidth(7, 200);
		setColumnWidth(8, 120);
	}
	else if (nType == 5)//撕裂报警记录查询
	{
		setColumnCount(6);
		headerText << A2T("序号") << A2T("点位名称") << A2T("开始时间") << A2T("结束时间") << A2T("报警截图") << A2T("操作");
		setColumnWidth(0, 100);
		setColumnWidth(1, 300);
		setColumnWidth(2, 300);
		setColumnWidth(3, 180);
		setColumnWidth(4, 250);
		setColumnWidth(5, 120);
		setColumnHidden(3, true);
	}
	setHorizontalHeaderLabels(headerText);
	verticalHeader()->setHidden(true);
	setShowGrid(false);
	horizontalHeader()->setStretchLastSection(true);
	setSelectionBehavior(QAbstractItemView::SelectRows);
}

void CTableWidgetB::InitData(int nType, QVector<QVector<QString>>vecStr)
{
	//m_sPageUuid = createGuid();
	//CImgDownloadTh::instance()->clearRequest();
	//QQueue<QPair<QUrl, QLabel*>> pairRequest;
	//if (nType == 0)
	//{
	//	setRowCount(vecStr.size());
	//	for (int i = 0; i < vecStr.size(); i++)
	//	{
	//		setRowHeight(i, 50);
	//		if (vecStr[i].size() < 12)
	//		{
	//			continue;
	//		}
	//		MyStructTask cMyStructTask;
	//		cMyStructTask.m_pLabIndex->setText(vecStr[i][0]);
	//		cMyStructTask.m_pLabTaskName->setText(vecStr[i][1]);
	//		cMyStructTask.m_pLabBeginTime->setText(vecStr[i][2]);
	//		cMyStructTask.m_pLabCountAll->setText(vecStr[i][3] + "/" + QString::number(vecStr[i][4].toInt() + vecStr[i][5].toInt()));
	//		cMyStructTask.m_pLabCountGood->setText(vecStr[i][4]);
	//		cMyStructTask.m_pLabCountFail->setText(vecStr[i][5]);
	//		cMyStructTask.m_pLabCountFailCollect->setText(vecStr[i][12]);
	//		cMyStructTask.m_pBtnView->setProperty("TaskExecGuid", vecStr[i][6]);
	//		cMyStructTask.m_pBtnView->setProperty("TaskName", vecStr[i][1]);
	//		cMyStructTask.m_pBtnView->setProperty("TaskExecDesc", A2T("任务名称:") + vecStr[i][1] + " " + A2T("开始时间:") + vecStr[i][2] + " "
	//			+ A2T("巡检项总数:") + vecStr[i][3] + " " + A2T("正常项数:") + vecStr[i][4] + " " + A2T("异常项数:") + vecStr[i][5] + " " + vecStr[i][9] + " " + vecStr[i][10]);
	//		cMyStructTask.m_pBtnPdfReport->setProperty("PdfReportUrl", vecStr[i][7]);
	//		cMyStructTask.m_pLabTaskStatus->setText(vecStr[i][8]);
	//		cMyStructTask.m_pBtnSyncPdfReport->setProperty("SyncPdfReportUrl", vecStr[i][11]);
	//		cMyStructTask.m_pBtnReCreRpbPdfRpt->setProperty("TaskExecGuid", vecStr[i][6]);
	//		if (vecStr[i][5].toInt() > 0 || vecStr[i][12].toInt()>0)
	//		{
	//			cMyStructTask.m_pLabIndex->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabTaskName->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabBeginTime->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabCountAll->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabCountGood->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabCountFail->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabCountFailCollect->setStyleSheet("color:red");
	//			cMyStructTask.m_pLabTaskStatus->setStyleSheet("color:red");
	//		}
	//		setCellWidget(i, 0, cMyStructTask.m_pLabIndex);
	//		setCellWidget(i, 1, cMyStructTask.m_pLabTaskName);
	//		setCellWidget(i, 2, cMyStructTask.m_pLabBeginTime);
	//		setCellWidget(i, 3, cMyStructTask.m_pLabCountAll);
	//		setCellWidget(i, 4, cMyStructTask.m_pLabCountGood);
	//		setCellWidget(i, 5, cMyStructTask.m_pLabCountFail);
	//		setCellWidget(i, 6, cMyStructTask.m_pLabCountFailCollect);
	//		setCellWidget(i, 7, cMyStructTask.m_pLabTaskStatus);
	//		setCellWidget(i, 8, cMyStructTask.m_pBtnView);
	//		setCellWidget(i, 9, cMyStructTask.m_pBtnPdfReport);
	//		setCellWidget(i, 10, cMyStructTask.m_pBtnSyncPdfReport);
	//		setCellWidget(i, 11, cMyStructTask.m_pBtnReCreRpbPdfRpt);
	//		connect(cMyStructTask.m_pBtnView, SIGNAL(clicked()), this, SLOT(slotClickedShowTask()));
	//		connect(cMyStructTask.m_pBtnPdfReport, SIGNAL(clicked()), this, SLOT(slotClickedShowPdfReport()));
	//		connect(cMyStructTask.m_pBtnSyncPdfReport, SIGNAL(clicked()), this, SLOT(slotClickedShowSyncPdfReport()));
	//		connect(cMyStructTask.m_pBtnReCreRpbPdfRpt, SIGNAL(clicked()), this, SLOT(slotReCreRobPdfRpt()));//重新生成机器人报表
	//	}
	//}
	//else if (nType == 1)
	//{
	//	setRowCount(vecStr.size());
	//	for (int i = 0; i < vecStr.size(); i++)
	//	{
	//		setRowHeight(i, 80);
	//		if (vecStr[i].size() < 9)
	//		{
	//			continue;
	//		}
	//		MyStructCotdetItem cMyStructCotdetItem;
	//		cMyStructCotdetItem.m_pLabIndex->setText(vecStr[i][0]);
	//		cMyStructCotdetItem.m_pLabTaskName->setText(vecStr[i][1]);
	//		cMyStructCotdetItem.m_pLabDeviceType->setText(vecStr[i][2]);
	//		cMyStructCotdetItem.m_pLabAlarmTime->setText(vecStr[i][3]);
	//		cMyStructCotdetItem.m_pLabAlarmResult->setText(vecStr[i][4]);
	//		cMyStructCotdetItem.m_pLabAlarmVal->setText(vecStr[i][5]);
	//		cMyStructCotdetItem.m_pLabAlarmLoc->setText(vecStr[i][6]);
	//		cMyStructCotdetItem.m_pLabAlarmRpllerCode->setText(vecStr[i][7]);
	//		cMyStructCotdetItem.m_pBtnImage->setFixedSize(120, 80);
	//		cMyStructCotdetItem.m_pBtnView->setProperty("HttpUrl", vecStr[i][8]);
	//		if (vecStr[i][8] != "")
	//		{
	//			//CImageDownloader* pImageDownloader = new CImageDownloader(cMyStructCotdetItem.m_pBtnImage, vecStr[i][8], this);
	//			pairRequest.enqueue(qMakePair(vecStr[i][8], cMyStructCotdetItem.m_pBtnImage));
	//			//CImgDownloadTh::instance()->addRequest(vecStr[i][8], cMyStructCotdetItem.m_pBtnImage, m_sPageUuid);
	//		}
	//		else
	//		{
	//			cMyStructCotdetItem.m_pBtnImage->setText("/");
	//		}
	//		setCellWidget(i, 0, cMyStructCotdetItem.m_pLabIndex);
	//		setCellWidget(i, 1, cMyStructCotdetItem.m_pLabTaskName);
	//		setCellWidget(i, 2, cMyStructCotdetItem.m_pLabDeviceType);
	//		setCellWidget(i, 3, cMyStructCotdetItem.m_pLabAlarmTime);
	//		setCellWidget(i, 4, cMyStructCotdetItem.m_pLabAlarmResult);
	//		setCellWidget(i, 5, cMyStructCotdetItem.m_pLabAlarmVal);
	//		setCellWidget(i, 6, cMyStructCotdetItem.m_pLabAlarmLoc);
	//		setCellWidget(i, 7, cMyStructCotdetItem.m_pLabAlarmRpllerCode);
	//		setCellWidget(i, 8, cMyStructCotdetItem.m_pBtnImage);
	//		setCellWidget(i, 9, cMyStructCotdetItem.m_pBtnView);
	//		connect(cMyStructCotdetItem.m_pBtnView, SIGNAL(clicked()), this, SLOT(slotClickedShowImg()));
	//	}
	//	CImgDownloadTh::instance()->addRequest(pairRequest,m_sPageUuid);
	//}
	//else if (nType == 2)
	//{
	//	setRowCount(vecStr.size());
	//	for (int i = 0; i < vecStr.size(); i++)
	//	{
	//		setRowHeight(i, 80);
	//		if (vecStr[i].size() < 17)
	//		{
	//			continue;
	//		}
	//		MyStructItem cMyStructItem;
	//		cMyStructItem.m_pLabIndex->setText(vecStr[i][0]);//序号
	//		cMyStructItem.m_pLabTaskName->setText(vecStr[i][1]);
	//		cMyStructItem.m_pLabPointName->setText(vecStr[i][2]);
	//		cMyStructItem.m_pRollerNo->setText(vecStr[i][3]);
	//		cMyStructItem.m_pLabItemName->setText(vecStr[i][4]);
	//		if (vecStr[i][5] == "0")
	//		{
	//			cMyStructItem.m_pLabDeviceType->setText(A2T("传感器"));
	//		}
	//		else if (vecStr[i][5] == "1")
	//		{
	//			cMyStructItem.m_pLabDeviceType->setText(A2T("云台"));
	//		}
	//		cMyStructItem.m_pLabActType->setText(vecStr[i][6]);
	//		cMyStructItem.m_pLabBeginTime->setText(vecStr[i][7]);
	//		if (vecStr[i][13].toInt() == 1)
	//		{
	//			cMyStructItem.m_pLabResult->setText(vecStr[i][8]);
	//			cMyStructItem.m_pLabAlarmVal->setText(vecStr[i][9]);
	//		}
	//		else if (vecStr[i][13].toInt() == 0)
	//		{
	//			cMyStructItem.m_pLabResult->setText(vecStr[i][8] + vecStr[i][15]);
	//			cMyStructItem.m_pLabAlarmVal->setText(vecStr[i][9] + vecStr[i][15]);
	//		}
	//		cMyStructItem.m_pBtnImage->setFixedSize(120, 80);
	//		if (vecStr[i][10] != "")
	//		{
	//			//CImgDownloadTh::instance()->addRequest(vecStr[i][10], cMyStructItem.m_pBtnImage, m_sPageUuid);
	//			//connect(CImgDownloadTh::instance(), &CImgDownloadTh::imageDownloaded, this, &CTableWidgetB::onImageDownloaded);
	//			//CImageDownloader* pImageDownloader = new CImageDownloader(cMyStructItem.m_pBtnImage, vecStr[i][10], this);
	//			pairRequest.enqueue(qMakePair(vecStr[i][10], cMyStructItem.m_pBtnImage));
	//		}
	//		else
	//		{
	//			cMyStructItem.m_pBtnImage->setText("/");
	//		}
	//		cMyStructItem.m_pBtnView->setProperty("TaskName", vecStr[i][1]);//任务名称
	//		cMyStructItem.m_pBtnView->setProperty("ItemExecGuid", vecStr[i][11]);
	//		cMyStructItem.m_pBtnView->setProperty("ItemName", vecStr[i][4]);
	//		cMyStructItem.m_pBtnView->setProperty("DeviceType", vecStr[i][5]);
	//		cMyStructItem.m_pBtnView->setProperty("PointName", vecStr[i][2]);//巡检点名称
	//		cMyStructItem.m_pBtnView->setProperty("IsCotdet", vecStr[i][13]);//是否持续检测巡检项
	//		cMyStructItem.m_pBtnView->setProperty("ItemTypeCode", vecStr[i][14]);//巡检项类型编码
	//		if (vecStr[i][8].toDouble() > vecStr[i][9].toDouble()|| vecStr[i][16].toDouble()>0)
	//		{
	//			cMyStructItem.m_pLabIndex->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabTaskName->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabPointName->setStyleSheet("color:red");
	//			cMyStructItem.m_pRollerNo->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabItemName->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabDeviceType->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabActType->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabBeginTime->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabResult->setStyleSheet("color:red");
	//			cMyStructItem.m_pLabAlarmVal->setStyleSheet("color:red");
	//		}
	//		setCellWidget(i, 0, cMyStructItem.m_pLabIndex);
	//		setCellWidget(i, 1, cMyStructItem.m_pLabTaskName);
	//		setCellWidget(i, 2, cMyStructItem.m_pLabPointName);
	//		setCellWidget(i, 3, cMyStructItem.m_pRollerNo);
	//		setCellWidget(i, 4, cMyStructItem.m_pLabItemName);
	//		setCellWidget(i, 5, cMyStructItem.m_pLabDeviceType);
	//		setCellWidget(i, 6, cMyStructItem.m_pLabActType);
	//		setCellWidget(i, 7, cMyStructItem.m_pLabBeginTime);
	//		setCellWidget(i, 8, cMyStructItem.m_pLabResult);
	//		setCellWidget(i, 9, cMyStructItem.m_pLabAlarmVal);
	//		setCellWidget(i, 10, cMyStructItem.m_pBtnImage);
	//		setCellWidget(i, 11, cMyStructItem.m_pBtnView);

	//		connect(cMyStructItem.m_pBtnView, SIGNAL(clicked()), this, SLOT(slotClickedShowItem()));
	//	}
	//	CImgDownloadTh::instance()->addRequest(pairRequest, m_sPageUuid);
	//}
	//else if (nType == 3)
	//{
	//	setRowCount(vecStr.size());
	//	for (int i = 0; i < vecStr.size(); i++)
	//	{
	//		setRowHeight(i, 80);
	//		if (vecStr[i].size() < 7)
	//		{
	//			continue;
	//		}
	//		MyStructAIAlarmItem cMyStructItem;
	//		cMyStructItem.m_pLabIndex->setText(vecStr[i][0]);//序号
	//		cMyStructItem.m_pLabAlgName->setText(vecStr[i][1]);
	//		cMyStructItem.m_pLabCamerName->setText(vecStr[i][2]);
	//		cMyStructItem.m_pLabAlarmTime->setText(vecStr[i][3]);
	//		cMyStructItem.m_pLabAlarmState->setText(vecStr[i][4]);
	//		if (vecStr[i][5] != "")
	//		{
	//			//CImgDownloadTh::instance()->addRequest(vecStr[i][5], cMyStructItem.m_pBtnImage, m_sPageUuid);
	//			//connect(CImgDownloadTh::instance(), &CImgDownloadTh::imageDownloaded, this, &CTableWidgetB::onImageDownloaded);
	//			//CImageDownloader* pImageDownloader = new CImageDownloader(cMyStructItem.m_pBtnImage, vecStr[i][5], this);
	//			pairRequest.enqueue(qMakePair(vecStr[i][5], cMyStructItem.m_pBtnImage));
	//		}
	//		else
	//		{
	//			cMyStructItem.m_pBtnImage->setText("/");
	//		}
	//		cMyStructItem.m_pBtnView->setProperty("AIAlarmInfoGuid", vecStr[i][6]);//报警记录Guid
	//		setCellWidget(i, 0, cMyStructItem.m_pLabIndex);
	//		setCellWidget(i, 1, cMyStructItem.m_pLabAlgName);
	//		setCellWidget(i, 2, cMyStructItem.m_pLabCamerName);
	//		setCellWidget(i, 3, cMyStructItem.m_pLabAlarmTime);
	//		setCellWidget(i, 4, cMyStructItem.m_pLabAlarmState);
	//		setCellWidget(i, 5, cMyStructItem.m_pBtnImage);
	//		setCellWidget(i, 6, cMyStructItem.m_pBtnView);
	//		connect(cMyStructItem.m_pBtnView, SIGNAL(clicked()), this, SLOT(slotClickedShowAIAlarmInfo()));
	//	}
	//	CImgDownloadTh::instance()->addRequest(pairRequest, m_sPageUuid);
	//}
	//else if (nType == 4)
	//{
	//	setRowCount(vecStr.size());
	//	for (int i = 0; i < vecStr.size(); i++)
	//	{
	//		setRowHeight(i, 80);
	//		if (vecStr[i].size() < 8)
	//		{
	//			continue;
	//		}
	//		MyStructCorrectItem cMyStructItem;
	//		cMyStructItem.m_pLabIndex->setText(vecStr[i][0]);//序号
	//		cMyStructItem.m_pLabPointName->setText(vecStr[i][1]);
	//		cMyStructItem.m_pLabStartTime->setText(vecStr[i][2]);
	//		cMyStructItem.m_pLabEndTime->setText(vecStr[i][3]);
	//		cMyStructItem.m_pLeftValue->setText(vecStr[i][4]);
	//		cMyStructItem.m_pRightValue->setText(vecStr[i][5]);
	//		cMyStructItem.m_pAlarmDesc->setText(vecStr[i][6]);
	//		if (vecStr[i][7] != "")
	//		{
	//			//CImgDownloadTh::instance()->addRequest(vecStr[i][7], cMyStructItem.m_pBtnImage, m_sPageUuid);
	//			//connect(CImgDownloadTh::instance(), &CImgDownloadTh::imageDownloaded, this, &CTableWidgetB::onImageDownloaded);
	//			//CImageDownloader* pImageDownloader = new CImageDownloader(cMyStructItem.m_pBtnImage, vecStr[i][7], this);
	//			pairRequest.enqueue(qMakePair(vecStr[i][7], cMyStructItem.m_pBtnImage));
	//		}
	//		else
	//		{
	//			cMyStructItem.m_pBtnImage->setText("/");
	//		}
	//		cMyStructItem.m_pBtnView->setProperty("HttpUrl", vecStr[i][7]);
	//		setCellWidget(i, 0, cMyStructItem.m_pLabIndex);
	//		setCellWidget(i, 1, cMyStructItem.m_pLabPointName);
	//		setCellWidget(i, 2, cMyStructItem.m_pLabStartTime);
	//		setCellWidget(i, 3, cMyStructItem.m_pLabEndTime);
	//		setCellWidget(i, 4, cMyStructItem.m_pLeftValue);
	//		setCellWidget(i, 5, cMyStructItem.m_pRightValue);
	//		setCellWidget(i, 6, cMyStructItem.m_pAlarmDesc);
	//		setCellWidget(i, 7, cMyStructItem.m_pBtnImage);
	//		setCellWidget(i, 8, cMyStructItem.m_pBtnView);
	//		connect(cMyStructItem.m_pBtnView, SIGNAL(clicked()), this, SLOT(slotClickedShowImg()));
	//	}
	//	CImgDownloadTh::instance()->addRequest(pairRequest, m_sPageUuid);
	//}
	//else if (nType == 5)
	//{
	//	setRowCount(vecStr.size());
	//	for (int i = 0; i < vecStr.size(); i++)
	//	{
	//		setRowHeight(i, 80);
	//		if (vecStr[i].size() < 5)
	//		{
	//			continue;
	//		}
	//		MyStructTearItem cMyStructItem;
	//		cMyStructItem.m_pLabIndex->setText(vecStr[i][0]);//序号
	//		cMyStructItem.m_pLabPointName->setText(vecStr[i][1]);
	//		cMyStructItem.m_pLabStartTime->setText(vecStr[i][2]);
	//		cMyStructItem.m_pLabEndTime->setText(vecStr[i][3]);
	//		if (vecStr[i][4] != "")
	//		{
	//			//CImageDownloader* pImageDownloader = new CImageDownloader(cMyStructItem.m_pBtnImage, vecStr[i][4], this);
	//			//CImgDownloadTh::instance()->addRequest(vecStr[i][4], cMyStructItem.m_pBtnImage, m_sPageUuid);
	//			//connect(CImgDownloadTh::instance(), &CImgDownloadTh::imageDownloaded, this, &CTableWidgetB::onImageDownloaded);
	//			pairRequest.enqueue(qMakePair(vecStr[i][4], cMyStructItem.m_pBtnImage));
	//		}
	//		else
	//		{
	//			cMyStructItem.m_pBtnImage->setText("/");
	//		}
	//		cMyStructItem.m_pBtnView->setProperty("HttpUrl", vecStr[i][4]);
	//		setCellWidget(i, 0, cMyStructItem.m_pLabIndex);
	//		setCellWidget(i, 1, cMyStructItem.m_pLabPointName);
	//		setCellWidget(i, 2, cMyStructItem.m_pLabStartTime);
	//		setCellWidget(i, 3, cMyStructItem.m_pLabEndTime);
	//		setCellWidget(i, 4, cMyStructItem.m_pBtnImage);
	//		setCellWidget(i, 5, cMyStructItem.m_pBtnView);
	//		connect(cMyStructItem.m_pBtnView, SIGNAL(clicked()), this, SLOT(slotClickedShowImg()));
	//	}
	//	CImgDownloadTh::instance()->addRequest(pairRequest, m_sPageUuid);
	//}
}

//设置小场景类型
void CTableWidgetB::setSmallSceneType(int nSmallSceneType)
{
	m_nSmallSceneType = nSmallSceneType;
}

void CTableWidgetB::slotClickedShowTask()
{
	QPushButton *btn = (QPushButton *)sender();
	QString sTaskExecId = btn->property("TaskExecGuid").toString();
	QString sTaskName = btn->property("TaskName").toString();
	QString sTaskExecDesc = btn->property("TaskExecDesc").toString();
	emit sigShowTask(sTaskExecId, sTaskName, sTaskExecDesc);
}

void CTableWidgetB::slotClickedShowItem()
{
	QPushButton *btn = (QPushButton *)sender();
	QString sTaskName = btn->property("TaskName").toString();
	QString sTaskExecId = btn->property("ItemExecGuid").toString();
	QString sDeviceType = btn->property("DeviceType").toString();//设备类型 0:本体传感器 1:云台
	QString sItemName = btn->property("ItemName").toString();
	QString sPointName = btn->property("PointName").toString();
	QString sIsCotdet = btn->property("IsCotdet").toString();
	QString sItemTypeCode = btn->property("ItemTypeCode").toString();
	emit sigShowItem(sTaskName, sTaskExecId, sItemName, sPointName, sDeviceType.toInt(), sIsCotdet.toInt(), sItemTypeCode.toInt());
}

//展示pdf报表
void CTableWidgetB::slotClickedShowPdfReport()
{
	//qDebug() << "pdf Report" << endl;
	QPushButton *btn = (QPushButton *)sender();
	QString strPdfReportUrl = btn->property("PdfReportUrl").toString();//pdf报表地址
	emit(sigShowPdf(strPdfReportUrl));
}

void CTableWidgetB::slotClickedShowSyncPdfReport()
{
	QPushButton *btn = (QPushButton *)sender();
	QString strPdfReportUrl = btn->property("SyncPdfReportUrl").toString();//pdf报表地址
	emit(sigShowPdf(strPdfReportUrl));
}

void CTableWidgetB::slotClickedShowAIAlarmInfo()
{
	QPushButton *btn = (QPushButton *)sender();
	QString strGuid = btn->property("AIAlarmInfoGuid").toString();//报警记录Guid
	emit sigShowAIAlarmInfo(strGuid);
}

void CTableWidgetB::slotClickedShowImg()
{
	QPushButton *btn = (QPushButton *)sender();
	QString sHttpUrl = btn->property("HttpUrl").toString();//报警图片
	emit sigShowImg(sHttpUrl);
}

void CTableWidgetB::onImageDownloaded(QLabel* pLabel, QPixmap pixmap,QString sPageUuid)
{
	if (sPageUuid == m_sPageUuid)
	{
		pLabel->setPixmap(pixmap);
		pLabel->setScaledContents(true);
		pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	}
}

//重新生成机器人报表
void CTableWidgetB::slotReCreRobPdfRpt()
{
	//if (m_pRptInterface == nullptr)
	//{
	//	m_pRptInterface = new CPdfRptInterface(m_nSmallSceneType);//new pdf报表接口类 需要传入小场景类型
	//}

	//QPushButton *pBtn = (QPushButton *)sender();
	//QString sTaskExecGuid = pBtn->property("TaskExecGuid").toString();//任务执行记录guid
	//QString sPdfFolderPath = CPublicData::instance().m_sPdfOutputPath;//输出文件夹(取xml中配置的)
	//QString sHttpPrefix = CPublicData::instance().m_sHttpUrl;//http路径前缀(取xml中配置的)
	//QString sClientCpyName = CPublicData::instance().m_sCustomName;//客户电厂名称(取xml中配置的)
	//m_pRptInterface->expQuerySigRobPdfRpt(sTaskExecGuid, sPdfFolderPath, sHttpPrefix, sClientCpyName);//接口类->查询导出单独机器人报表


	//messageBox(0, A2T("已在后台重新生成机器人报表中,请稍后点击查看最新报表..."));
}
